package com.heihei.itextdemo.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 分页参数父类
 *
 */
@Data
@NoArgsConstructor
public class TableQueryParamDTO {

	/**页数*/
	@ApiModelProperty(value = "页数")
	private Integer page;

	/**条数*/
	@ApiModelProperty(value = "条数")
	private Integer rows;

	/** 排序字段名称 */
	@ApiModelProperty(value = "排序字段名称")
	private String sortField;

	/** 排序字段排序方式(asc,desc) */
	@ApiModelProperty(value = "排序字段排序方式(asc,desc)")
	private String sortValue;

	/**企业id*/
	@ApiModelProperty(value = "企业id")
	private String companyId;

	/** 获取分页起始行 */
	public Integer getStartRow() {
		if (this.page != null && this.rows != null) {
			Integer start = (this.page - 1) * this.rows;
			return start < 0 ? 0 : start;
		}
		return null;
	}

}